package school.valon.persistence.dao.impl;

import school.valon.persistence.dao.StudentClassRecordingDao;
import school.valon.persistence.dao.base.impl.GenericDaoImpl;
import school.valon.persistence.pojo.CommentType;
import school.valon.persistence.pojo.StudentClassRecording;
import school.valon.persistence.pojo.StudentClassRecordingComment;

public class StudentClassRecordingDaoImpl extends GenericDaoImpl<StudentClassRecording, Integer> implements StudentClassRecordingDao {
	public CommentType findCommentType(Integer commentTypeId) {
		return em.find(CommentType.class, commentTypeId);
	}
	
	public StudentClassRecordingComment findStudentClassRecordingComment(Integer studentClassRecordingCommentId) {
		return em.find(StudentClassRecordingComment.class, studentClassRecordingCommentId);
	}

	public StudentClassRecordingComment createStudentClassRecordingComment(StudentClassRecordingComment studentClassRecordingComment) {
		em.persist(studentClassRecordingComment);
		return studentClassRecordingComment;
	}

	public StudentClassRecordingComment updateStudentClassRecordingComment(StudentClassRecordingComment studentClassRecordingComment) {
		return em.merge(studentClassRecordingComment);
	}

	public void deleteStudentClassRecordingComment(Integer studentClassRecordingCommentId) {
    	em.createNamedQuery("StudentClassRecordingComment.deleteById")
			.setParameter("P1", studentClassRecordingCommentId).executeUpdate();
	}
}

